#!/usr/bin/env python
#-*- coding: utf-8 -*-

'''
# Author    : cold night
# Filename    : index.py
# Descriable: just a interface
'''
import setting
from os import path
from app import *
from bottle import run
from bottle import route
from bottle import default_app
from bottle import debug
from bottle import request
from bottle import error
from bottle import route
from bottle import static_file
from bottle import template
from bottle import redirect
from bottle import abort
from setting import WEB_STATIC


if not WEB_STATIC:
    @route('/static/:filename#.*#')
    def server_static(filename):
        return static_file(filename, root='./static/')

if path.exists('app/install.py'):
    @route('/:#.*#')
    def red():
        redirect('/install/')

        
debug(setting.DEBUG)
if __name__ == "__main__":
    app = default_app()
    run(app=app, host="0.0.0.0", port=8888, reloader=True)
else:
    app = default_app()
    application = app
